package com.bw.goods.mvvm.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bw.goods.R;
import com.youth.banner.adapter.BannerAdapter;

import org.jetbrains.annotations.NotNull;

import java.util.List;

/**
 * @author KK
 * @description:
 * @date :2021/10/14 19:17
 */
public class HomeTextBannerAdapter extends BannerAdapter<String, HomeTextBannerAdapter.HomeTextBannerViewHolder>  {


    public HomeTextBannerAdapter(List<String> datas) {
        super(datas);
    }

    @Override
    public HomeTextBannerViewHolder onCreateHolder(ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_home_txt_banner,parent,false);
        ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        itemView.setLayoutParams(lp);
        return new HomeTextBannerViewHolder(itemView);
    }

    @Override
    public void onBindView(HomeTextBannerViewHolder holder, String data, int position, int size) {
        holder.txtbanner_item.setText(data);
    }

    public static class HomeTextBannerViewHolder extends RecyclerView.ViewHolder {
        TextView txtbanner_item;
        public HomeTextBannerViewHolder(@NonNull @NotNull View itemView) {
            super(itemView);
            txtbanner_item = itemView.findViewById(R.id.txtbanner_item);
        }
    }
}
